package com.example.zlpermissionservice.dto.request;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author zhenliu（孙凌岳）
 * @Description AI-前端请求角色参数封装
 * @Date 2025/6/17 9:25
 * @Version 1.0
 */
@Data
@NoArgsConstructor
public class RoleReqDTO implements Serializable {
    @ApiModelProperty(value = "角色名称")
    private String roleName;

    @ApiModelProperty(value = "角色标识")
    private String label;

    @ApiModelProperty(value = "排序")
    private Integer sortNo;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "人员查询部门：当前人员Id")
    private String userId;

    @ApiModelProperty(value = "数据范围（0自定义  1本人 2本部门及以下 3本部门 4全部）")
    private String dataScope;

    @ApiModelProperty(value = "是否启用（0:启用，1:禁用）")
    private String dataState;

    @ApiModelProperty(value = "TREE结构：选中资源No")
    private String[] checkedResourceNos;

    @ApiModelProperty(value = "TREE结构：选中部门No")
    private String[] checkedDeptNos;

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "创建者:username")
    private Long createBy;

    @ApiModelProperty(value = "更新者:username")
    private Long updateBy;

    /**
     * 搜索值
     */
    @JsonIgnore
    private String searchValue;

    /**
     * 请求参数
     */
    @JsonIgnore
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

    @Builder
    public RoleReqDTO(String roleName, String label, Integer sortNo, String remark, String userId, String dataScope, String dataState, String[] checkedResourceNos, String[] checkedDeptNos, Long id, Long createBy, Long updateBy, String searchValue, Map<String, Object> params) {
        this.roleName = roleName;
        this.label = label;
        this.sortNo = sortNo;
        this.remark = remark;
        this.userId = userId;
        this.dataScope = dataScope;
        this.dataState = dataState;
        this.checkedResourceNos = checkedResourceNos;
        this.checkedDeptNos = checkedDeptNos;
        this.id = id;
        this.createBy = createBy;
        this.updateBy = updateBy;
        this.searchValue = searchValue;
        this.params = params;
    }
}
